package thethree;
import java.util.*;
public class test{
	//静态方法
	static int application(String a,String b) {
		if(a.equals(b))return 1;
		else return 0;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String a1=sc.nextLine();
		String a2 = sc.nextLine();
		String a3 = sc.nextLine();
		String a4 = sc.nextLine();
		//比较字符串是否相等
		System.out.println(application(a1,a2));
		System.out.println(application(a3,a4));
	}
}